package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.HouseInfoDao;
import cn.topevery.garden.entity.dto.HouseInfoDTO;
import cn.topevery.garden.entity.po.HouseInfo;
import cn.topevery.garden.entity.query.HouseInfoQuery;
import cn.topevery.garden.entity.vo.HouseInfoVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 房屋信息表
 *
 * @author code-generate
 * @date 2022-02-14
 */
@Service
public class HouseInfoLogic extends BaseLogic<HouseInfo> {
    @Autowired
    HouseInfoDao houseInfoDao;

    @Override
    public BaseEntityDao<HouseInfo, Integer> getDao() {
        return houseInfoDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<HouseInfoVO> listPage(HouseInfoQuery query) {
        return houseInfoDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        houseInfoDao.deleteBatchById(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param houseInfo 实体
     */
    public void saveOrUpdate(String userId, HouseInfo houseInfo){
        houseInfoDao.saveOrUpdate(userId,houseInfo);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public HouseInfo getEntityByColumn(String key, String value) {
        return houseInfoDao.getEntityByColumn(key, value);
    }

    public void commit(HouseInfoDTO dto, Integer userId) {
        houseInfoDao.commit(dto, userId);
    }

    public List<Map<String, Object>> getHouseIdList() {
        return houseInfoDao.getHouseIdList();
    }
}
